import {api} from "@/utils/request";

// 获取全部角色信息（分页条件查询）
export const geRoleListApi = (pageNum:any , pageSize:any , roleName:any) => {
    return api({
        url: "/sys/role/list/"+ pageNum + "/" + pageSize,
        method: "post",
        params: {
            roleName: roleName
        }
    })
}

// 新增角色信息
export const addRole = (data:any) => {
    return api({
        url: "/sys/role/add",
        method: "post",
        data: data
    })
}

// 修改角色信息
export const updateRole = (data:any) => {
    return api({
        url: "/sys/role/update",
        method: "post",
        data: data
    })
}

// 根据id删除用户信息
export const deletedByIdRole = (id:any) => {
    return api({
        url: "/sys/role/deleted/" + id,
        method: "delete"
    })
}

// 查询全部角色信息
export const getRoleList = () => {
    return api({
        url: "/sys/role/getAll",
        method: "get"
    })
}
//查询所有菜单，并返回角色拥有的菜单
export const GetSysRoleMenuIds = (roleId:number) => {
    return api({
        url: "/sys/role/findSysRoleMenuByRoleId/"+ roleId,
        method: 'get'
    })
}



// 根据角色分配菜单请求方法
export const DoAssignMenuIdToSysRole = (assignMenuDto:any) => {
    return api({
        url: "/sys/role/doAssign",
        method: 'post',
        data: assignMenuDto
    })
}


